\(\int \tan (c+d x) (a+i a \tan (c+d x))^4 \, dx\) [36]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 22, antiderivative size = 108 \[ \int \tan (c+d x) (a+i a \tan (c+d x))^4 \, dx=-8 i a^4 x-\frac {8 a^4 \log (\cos (c+d x))}{d}+\frac {4 i a^4 \tan (c+d x)}{d}+\frac {a (a+i a \tan (c+d x))^3}{3 d}+\frac {(a+i a \tan (c+d x))^4}{4 d}+\frac {\left (a^2+i a^2 \tan (c+d x)\right )^2}{d} \]

[Out]

-8*I*a^4*x-8*a^4*ln(cos(d*x+c))/d+4*I*a^4*tan(d*x+c)/d+1/3*a*(a+I*a*tan(d*x+c))^3/d+1/4*(a+I*a*tan(d*x+c))^4/d
+(a^2+I*a^2*tan(d*x+c))^2/d

Rubi [A] (verified)

Time = 0.09 (sec) , antiderivative size = 108, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.182, Rules used = {3608, 3559, 3558, 3556} \[ \int \tan (c+d x) (a+i a \tan (c+d x))^4 \, dx=\frac {4 i a^4 \tan (c+d x)}{d}-\frac {8 a^4 \log (\cos (c+d x))}{d}-8 i a^4 x+\frac {\left (a^2+i a^2 \tan (c+d x)\right )^2}{d}+\frac {a (a+i a \tan (c+d x))^3}{3 d}+\frac {(a+i a \tan (c+d x))^4}{4 d} \]

[In]

Int[Tan[c + d*x]*(a + I*a*Tan[c + d*x])^4,x]

[Out]

(-8*I)*a^4*x - (8*a^4*Log[Cos[c + d*x]])/d + ((4*I)*a^4*Tan[c + d*x])/d + (a*(a + I*a*Tan[c + d*x])^3)/(3*d) +
 (a + I*a*Tan[c + d*x])^4/(4*d) + (a^2 + I*a^2*Tan[c + d*x])^2/d

Rule 3556

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3558

Int[((a_) + (b_.)*tan[(c_.) + (d_.)*(x_)])^2, x_Symbol] :> Simp[(a^2 - b^2)*x, x] + (Dist[2*a*b, Int[Tan[c + d
*x], x], x] + Simp[b^2*(Tan[c + d*x]/d), x]) /; FreeQ[{a, b, c, d}, x]

Rule 3559

Int[((a_) + (b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[b*((a + b*Tan[c + d*x])^(n - 1)/(d*(n - 1))
), x] + Dist[2*a, Int[(a + b*Tan[c + d*x])^(n - 1), x], x] /; FreeQ[{a, b, c, d}, x] && EqQ[a^2 + b^2, 0] && G
tQ[n, 1]

Rule 3608

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[d*(
(a + b*Tan[e + f*x])^m/(f*m)), x] + Dist[(b*c + a*d)/b, Int[(a + b*Tan[e + f*x])^m, x], x] /; FreeQ[{a, b, c,
d, e, f, m}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 + b^2, 0] &&  !LtQ[m, 0]

Rubi steps \begin{align*} \text {integral}& = \frac {(a+i a \tan (c+d x))^4}{4 d}-i \int (a+i a \tan (c+d x))^4 \, dx \\ & = \frac {a (a+i a \tan (c+d x))^3}{3 d}+\frac {(a+i a \tan (c+d x))^4}{4 d}-(2 i a) \int (a+i a \tan (c+d x))^3 \, dx \\ & = \frac {a (a+i a \tan (c+d x))^3}{3 d}+\frac {(a+i a \tan (c+d x))^4}{4 d}+\frac {\left (a^2+i a^2 \tan (c+d x)\right )^2}{d}-\left (4 i a^2\right ) \int (a+i a \tan (c+d x))^2 \, dx \\ & = -8 i a^4 x+\frac {4 i a^4 \tan (c+d x)}{d}+\frac {a (a+i a \tan (c+d x))^3}{3 d}+\frac {(a+i a \tan (c+d x))^4}{4 d}+\frac {\left (a^2+i a^2 \tan (c+d x)\right )^2}{d}+\left (8 a^4\right ) \int \tan (c+d x) \, dx \\ & = -8 i a^4 x-\frac {8 a^4 \log (\cos (c+d x))}{d}+\frac {4 i a^4 \tan (c+d x)}{d}+\frac {a (a+i a \tan (c+d x))^3}{3 d}+\frac {(a+i a \tan (c+d x))^4}{4 d}+\frac {\left (a^2+i a^2 \tan (c+d x)\right )^2}{d} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.27 (sec) , antiderivative size = 67, normalized size of antiderivative = 0.62 \[ \int \tan (c+d x) (a+i a \tan (c+d x))^4 \, dx=\frac {a^4 \left (19+96 \log (i+\tan (c+d x))+96 i \tan (c+d x)-42 \tan ^2(c+d x)-16 i \tan ^3(c+d x)+3 \tan ^4(c+d x)\right )}{12 d} \]

[In]

Integrate[Tan[c + d*x]*(a + I*a*Tan[c + d*x])^4,x]

[Out]

(a^4*(19 + 96*Log[I + Tan[c + d*x]] + (96*I)*Tan[c + d*x] - 42*Tan[c + d*x]^2 - (16*I)*Tan[c + d*x]^3 + 3*Tan[
c + d*x]^4))/(12*d)

Maple [A] (verified)

Time = 0.28 (sec) , antiderivative size = 72, normalized size of antiderivative = 0.67

method result size
derivativedivides \(\frac {a^{4} \left (8 i \tan \left (d x +c \right )+\frac {\left (\tan ^{4}\left (d x +c \right )\right )}{4}-\frac {4 i \left (\tan ^{3}\left (d x +c \right )\right )}{3}-\frac {7 \left (\tan ^{2}\left (d x +c \right )\right )}{2}+4 \ln \left (1+\tan ^{2}\left (d x +c \right )\right )-8 i \arctan \left (\tan \left (d x +c \right )\right )\right )}{d}\) \(72\)
default \(\frac {a^{4} \left (8 i \tan \left (d x +c \right )+\frac {\left (\tan ^{4}\left (d x +c \right )\right )}{4}-\frac {4 i \left (\tan ^{3}\left (d x +c \right )\right )}{3}-\frac {7 \left (\tan ^{2}\left (d x +c \right )\right )}{2}+4 \ln \left (1+\tan ^{2}\left (d x +c \right )\right )-8 i \arctan \left (\tan \left (d x +c \right )\right )\right )}{d}\) \(72\)
parallelrisch \(-\frac {16 i a^{4} \left (\tan ^{3}\left (d x +c \right )\right )-3 \left (\tan ^{4}\left (d x +c \right )\right ) a^{4}+96 i a^{4} x d -96 i a^{4} \tan \left (d x +c \right )+42 a^{4} \left (\tan ^{2}\left (d x +c \right )\right )-48 a^{4} \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{12 d}\) \(83\)
risch \(\frac {16 i a^{4} c}{d}-\frac {4 a^{4} \left (30 \,{\mathrm e}^{6 i \left (d x +c \right )}+63 \,{\mathrm e}^{4 i \left (d x +c \right )}+50 \,{\mathrm e}^{2 i \left (d x +c \right )}+14\right )}{3 d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{4}}-\frac {8 a^{4} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}{d}\) \(88\)
norman \(-\frac {7 a^{4} \left (\tan ^{2}\left (d x +c \right )\right )}{2 d}+\frac {a^{4} \left (\tan ^{4}\left (d x +c \right )\right )}{4 d}-8 i a^{4} x +\frac {8 i a^{4} \tan \left (d x +c \right )}{d}-\frac {4 i a^{4} \left (\tan ^{3}\left (d x +c \right )\right )}{3 d}+\frac {4 a^{4} \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{d}\) \(92\)
parts \(\frac {7 a^{4} \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2 d}+\frac {a^{4} \left (\frac {\left (\tan ^{4}\left (d x +c \right )\right )}{4}-\frac {\left (\tan ^{2}\left (d x +c \right )\right )}{2}+\frac {\ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}\right )}{d}-\frac {4 i a^{4} \left (\frac {\left (\tan ^{3}\left (d x +c \right )\right )}{3}-\tan \left (d x +c \right )+\arctan \left (\tan \left (d x +c \right )\right )\right )}{d}+\frac {4 i a^{4} \left (\tan \left (d x +c \right )-\arctan \left (\tan \left (d x +c \right )\right )\right )}{d}-\frac {3 a^{4} \left (\tan ^{2}\left (d x +c \right )\right )}{d}\) \(138\)

[In]

int(tan(d*x+c)*(a+I*a*tan(d*x+c))^4,x,method=_RETURNVERBOSE)

[Out]

1/d*a^4*(8*I*tan(d*x+c)+1/4*tan(d*x+c)^4-4/3*I*tan(d*x+c)^3-7/2*tan(d*x+c)^2+4*ln(1+tan(d*x+c)^2)-8*I*arctan(t
an(d*x+c)))

Fricas [A] (verification not implemented)

none

Time = 0.23 (sec) , antiderivative size = 174, normalized size of antiderivative = 1.61 \[ \int \tan (c+d x) (a+i a \tan (c+d x))^4 \, dx=-\frac {4 \, {\left (30 \, a^{4} e^{\left (6 i \, d x + 6 i \, c\right )} + 63 \, a^{4} e^{\left (4 i \, d x + 4 i \, c\right )} + 50 \, a^{4} e^{\left (2 i \, d x + 2 i \, c\right )} + 14 \, a^{4} + 6 \, {\left (a^{4} e^{\left (8 i \, d x + 8 i \, c\right )} + 4 \, a^{4} e^{\left (6 i \, d x + 6 i \, c\right )} + 6 \, a^{4} e^{\left (4 i \, d x + 4 i \, c\right )} + 4 \, a^{4} e^{\left (2 i \, d x + 2 i \, c\right )} + a^{4}\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right )\right )}}{3 \, {\left (d e^{\left (8 i \, d x + 8 i \, c\right )} + 4 \, d e^{\left (6 i \, d x + 6 i \, c\right )} + 6 \, d e^{\left (4 i \, d x + 4 i \, c\right )} + 4 \, d e^{\left (2 i \, d x + 2 i \, c\right )} + d\right )}} \]

[In]

integrate(tan(d*x+c)*(a+I*a*tan(d*x+c))^4,x, algorithm="fricas")

[Out]

-4/3*(30*a^4*e^(6*I*d*x + 6*I*c) + 63*a^4*e^(4*I*d*x + 4*I*c) + 50*a^4*e^(2*I*d*x + 2*I*c) + 14*a^4 + 6*(a^4*e
^(8*I*d*x + 8*I*c) + 4*a^4*e^(6*I*d*x + 6*I*c) + 6*a^4*e^(4*I*d*x + 4*I*c) + 4*a^4*e^(2*I*d*x + 2*I*c) + a^4)*
log(e^(2*I*d*x + 2*I*c) + 1))/(d*e^(8*I*d*x + 8*I*c) + 4*d*e^(6*I*d*x + 6*I*c) + 6*d*e^(4*I*d*x + 4*I*c) + 4*d
*e^(2*I*d*x + 2*I*c) + d)

Sympy [A] (verification not implemented)

Time = 0.28 (sec) , antiderivative size = 170, normalized size of antiderivative = 1.57 \[ \int \tan (c+d x) (a+i a \tan (c+d x))^4 \, dx=- \frac {8 a^{4} \log {\left (e^{2 i d x} + e^{- 2 i c} \right )}}{d} + \frac {- 120 a^{4} e^{6 i c} e^{6 i d x} - 252 a^{4} e^{4 i c} e^{4 i d x} - 200 a^{4} e^{2 i c} e^{2 i d x} - 56 a^{4}}{3 d e^{8 i c} e^{8 i d x} + 12 d e^{6 i c} e^{6 i d x} + 18 d e^{4 i c} e^{4 i d x} + 12 d e^{2 i c} e^{2 i d x} + 3 d} \]

[In]

integrate(tan(d*x+c)*(a+I*a*tan(d*x+c))**4,x)

[Out]

-8*a**4*log(exp(2*I*d*x) + exp(-2*I*c))/d + (-120*a**4*exp(6*I*c)*exp(6*I*d*x) - 252*a**4*exp(4*I*c)*exp(4*I*d
*x) - 200*a**4*exp(2*I*c)*exp(2*I*d*x) - 56*a**4)/(3*d*exp(8*I*c)*exp(8*I*d*x) + 12*d*exp(6*I*c)*exp(6*I*d*x)
+ 18*d*exp(4*I*c)*exp(4*I*d*x) + 12*d*exp(2*I*c)*exp(2*I*d*x) + 3*d)

Maxima [A] (verification not implemented)

none

Time = 0.30 (sec) , antiderivative size = 82, normalized size of antiderivative = 0.76 \[ \int \tan (c+d x) (a+i a \tan (c+d x))^4 \, dx=\frac {3 \, a^{4} \tan \left (d x + c\right )^{4} - 16 i \, a^{4} \tan \left (d x + c\right )^{3} - 42 \, a^{4} \tan \left (d x + c\right )^{2} - 96 i \, {\left (d x + c\right )} a^{4} + 48 \, a^{4} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 96 i \, a^{4} \tan \left (d x + c\right )}{12 \, d} \]

[In]

integrate(tan(d*x+c)*(a+I*a*tan(d*x+c))^4,x, algorithm="maxima")

[Out]

1/12*(3*a^4*tan(d*x + c)^4 - 16*I*a^4*tan(d*x + c)^3 - 42*a^4*tan(d*x + c)^2 - 96*I*(d*x + c)*a^4 + 48*a^4*log
(tan(d*x + c)^2 + 1) + 96*I*a^4*tan(d*x + c))/d

Giac [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 222 vs. \(2 (94) = 188\).

Time = 0.55 (sec) , antiderivative size = 222, normalized size of antiderivative = 2.06 \[ \int \tan (c+d x) (a+i a \tan (c+d x))^4 \, dx=-\frac {4 \, {\left (6 \, a^{4} e^{\left (8 i \, d x + 8 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 24 \, a^{4} e^{\left (6 i \, d x + 6 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 36 \, a^{4} e^{\left (4 i \, d x + 4 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 24 \, a^{4} e^{\left (2 i \, d x + 2 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 30 \, a^{4} e^{\left (6 i \, d x + 6 i \, c\right )} + 63 \, a^{4} e^{\left (4 i \, d x + 4 i \, c\right )} + 50 \, a^{4} e^{\left (2 i \, d x + 2 i \, c\right )} + 6 \, a^{4} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 14 \, a^{4}\right )}}{3 \, {\left (d e^{\left (8 i \, d x + 8 i \, c\right )} + 4 \, d e^{\left (6 i \, d x + 6 i \, c\right )} + 6 \, d e^{\left (4 i \, d x + 4 i \, c\right )} + 4 \, d e^{\left (2 i \, d x + 2 i \, c\right )} + d\right )}} \]

[In]

integrate(tan(d*x+c)*(a+I*a*tan(d*x+c))^4,x, algorithm="giac")

[Out]

-4/3*(6*a^4*e^(8*I*d*x + 8*I*c)*log(e^(2*I*d*x + 2*I*c) + 1) + 24*a^4*e^(6*I*d*x + 6*I*c)*log(e^(2*I*d*x + 2*I
*c) + 1) + 36*a^4*e^(4*I*d*x + 4*I*c)*log(e^(2*I*d*x + 2*I*c) + 1) + 24*a^4*e^(2*I*d*x + 2*I*c)*log(e^(2*I*d*x
 + 2*I*c) + 1) + 30*a^4*e^(6*I*d*x + 6*I*c) + 63*a^4*e^(4*I*d*x + 4*I*c) + 50*a^4*e^(2*I*d*x + 2*I*c) + 6*a^4*
log(e^(2*I*d*x + 2*I*c) + 1) + 14*a^4)/(d*e^(8*I*d*x + 8*I*c) + 4*d*e^(6*I*d*x + 6*I*c) + 6*d*e^(4*I*d*x + 4*I
*c) + 4*d*e^(2*I*d*x + 2*I*c) + d)

Mupad [B] (verification not implemented)

Time = 4.81 (sec) , antiderivative size = 72, normalized size of antiderivative = 0.67 \[ \int \tan (c+d x) (a+i a \tan (c+d x))^4 \, dx=\frac {8\,a^4\,\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )-\frac {7\,a^4\,{\mathrm {tan}\left (c+d\,x\right )}^2}{2}+\frac {a^4\,{\mathrm {tan}\left (c+d\,x\right )}^4}{4}+a^4\,\mathrm {tan}\left (c+d\,x\right )\,8{}\mathrm {i}-\frac {a^4\,{\mathrm {tan}\left (c+d\,x\right )}^3\,4{}\mathrm {i}}{3}}{d} \]

[In]

int(tan(c + d*x)*(a + a*tan(c + d*x)*1i)^4,x)

[Out]

(8*a^4*log(tan(c + d*x) + 1i) + a^4*tan(c + d*x)*8i - (7*a^4*tan(c + d*x)^2)/2 - (a^4*tan(c + d*x)^3*4i)/3 + (
a^4*tan(c + d*x)^4)/4)/d